import React from 'react'

export default function Chkbox(props) {
  const { id, label, checked, disabled, onChange } = props
  const style = { verticalAlign: 'middle' }

  return (
    <>
      <label htmlFor={id} style={style}>
        {label}
      </label>
      <input
        id={id}
        style={style}
        type="checkbox"
        checked={checked}
        disabled={disabled}
        onChange={(e) => onChange({ checked: e.target.checked, label })}
      />
    </>
  )
}
